<template>
  <div class="follow-page">
    <!-- 顶部导航（返回键 + 居中标题） -->
    <div class="header">
      <div class="back-btn" @click="handleBack">
        <span class="arrow">&lt;</span> <!-- 纯CSS返回箭头 -->
      </div>
      <h1 class="title">我的关注</h1>
    </div>

    <!-- 标签栏 -->
    <div class="tab-bar">
      <div
          v-for="(tab, idx) in tabs"
          :key="idx"
          :class="['tab-item', { active: currentTab === idx }]"
          @click="currentTab = idx"
      >
        {{ tab.title }}
      </div>
    </div>

    <!-- 内容区域 -->
    <div class="content">
      <div v-if="currentTab === 0" class="empty-state">
        <img src="/public/icons/fellow.png" alt="关注的人" class="empty-img" />
      </div>
      <div v-else class="empty-state">
        <img src="/public/icons/fellow2.png" alt="关注的圈子" class="empty-img" />
        <p class="sub-desc">
          <a href="/circle-square" class="link">去圈子广场</a> 探索更多
        </p>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
const tabs = ref([{ title: '关注的人' }, { title: '关注的圈子' }]);
const currentTab = ref(0);

const handleBack = () => {
  router.back();
};
</script>

<style scoped>
.follow-page {
  background-color: #f8f8f8;
  min-height: 100vh;
  padding: 15px;
}

.header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background-color: #fff;
  border-radius: 8px;
  margin-bottom: 15px;
}

.back-btn {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.arrow {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.title {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  margin: 0;
}

.tab-bar {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  background-color: #fff;
  border-radius: 8px;
  margin-bottom: 15px;
}

.tab-item {
  padding: 8px 15px;
  cursor: pointer;
  font-size: 16px;
}

.tab-item.active {
  color: #409eff;
  border-bottom: 2px solid #409eff;
}

.content {
  padding: 10px;
}

.empty-state {
  text-align: center;
  padding: 50px 0;
}

.empty-img {
  width: 150px;
  height: 150px;
  margin-bottom: 15px;
}

.desc {
  font-size: 16px;
  color: #333;
  margin-bottom: 5px;
}

.sub-desc {
  font-size: 14px;
  color: #999;
}

.link {
  color: #409eff;
  text-decoration: none;
}
</style>